<template>
  <el-row>
    <el-col :span="8" :offset="8">
      <el-card :body-style="{ padding: '0px' }">
        <img
          src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
          class="image"
        />
        <div style="padding: 14px">
          <span>欢迎来到首页(登录注册成功)</span>
          <div class="bottom">
            <time class="time">{{ currentDate }}</time>
            <el-button
              type="success"
              @click="sendToWebSocket()"
              :icon="Message"
              circle
            />
          </div>
        </div>
      </el-card>
    </el-col>
  </el-row>
</template>

<script lang="ts" setup>
import { ref, inject, onMounted } from "vue";
import { Message } from "@element-plus/icons-vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
const router = useRouter();
const notifyMsg = inject("notifyMsg", Function, false);
const createWebSocket = inject("createWebSocket", Function, true);
const testFun = inject("testFun", Function, false);
onMounted(() => {
  const userId = router.currentRoute.value.query.userID;
  if (userId != undefined) {
    // console.log(userId);
    // testFun('5201314');
    createWebSocket(userId);
    // console.log("有参数");
  }
  // console.log(router.currentRoute.value.query.userID);
});
const currentDate = ref(new Date());
// let open1 = inject("open1", Function, false);
const sendToWebSocket = () => {
  notifyMsg();
};
</script>

<style>
.time {
  font-size: 12px;
  color: #999;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.button {
  padding: 0;
  min-height: auto;
}

.image {
  width: 100%;
  display: block;
}
</style>
